<template>
	<view class="content">
		<!-- #ifdef H5 || APP-PLUS -->
		<view class="message-title">
			<commonTitle title="公告详情"></commonTitle>
		</view>
		<!-- #endif -->
		<view class="list-scroll-content nopadding">
			<view class="messageDetail">
				<view class="notice">{{msgDetail.title}}</view>
				<view class="notice-time">
					<view class="notice-time-day">{{msgDetail.publishTime}}</view>
					<!-- <view class="notice-time-hours">22:42:09</view> -->
				</view>
				<view class="notice-text">
					<jyf-parser :html="msgDetail.content"  lazy-load ref="article" selectable
					 show-with-animation use-anchor @error="error" @imgtap="imgtap" @linkpress="linkpress" @ready="ready">加载中...</jyf-parser>
				
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import commonTitle from'../../components/titile/title.vue'
	import jyfParser from '../../components/jyf-parser/jyf-parser.vue';
	export default{
		data(){
			return{
				msgDetail:"",
				apptoken:""
			}
		},
		onLoad(option) {
			this.apptoken = uni.getStorageSync("apptoken");
			this.getMsgDetail(option.articleId);
		},
		components:{
			commonTitle,jyfParser
		},
		methods:{
			getMsgDetail(articleId){
				//公告详情
				const _this = this;
				uni.request({
					url:this.$API.URL + this.$API.article_detail,
					data:{articleId:articleId,apptoken:this.apptoken},
					success(res){
						console.log(res)
						_this.msgDetail = res.data.data;
					}
				})
			},
			ready(e) {
				console.log('ready', e);
				// console.log('api: getText', this.$refs.article.getText());
				console.log('imgList', this.$refs.article.imgList);
			},
			imgtap(e) {
				console.log('imgtap', e);
			},
			linkpress(e) {
				console.log('linkpress', e);
			},
			error(e) {
				console.error(e);
			}
		}
	}
</script>

<style>
	@import url("message.css");
</style>
